﻿using System;
using System.Threading;
using System.Web;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebControls;

namespace ZhukBlogSharePointProject.Layouts.ZhukBlogSharePointProject
{
    public partial class LongTimeOperation : LayoutsPageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void ltopButtonClick(object sender, EventArgs e)
        {
            var comeBackUrl = "LongTimeOperation.aspx?Complete";
            using (var operation = new SPLongOperation(Page))
            {
                operation.LeadingHTML = "LeadingHTML";
                operation.TrailingHTML = "TrailingHTML";
                operation.Begin();

                Thread.Sleep(7000); // Эмитация долгой операции

                operation.End(comeBackUrl, SPRedirectFlags.DoNotEncodeUrl, HttpContext.Current, null);
            }
        }
    }
}
